package cn.jinzhu.provider.controller;

import cn.jinzhu.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
public class RegisterContrller {
    @PostMapping("/res") //重定向的路径一定是绝对路径 postLication
    public String Res(User user){

        System.out.println( "redirect:http://provider/loginPage?name="+user.getName()+"&pass="+user.getPass());
        return "redirect:http://provider/loginPage?name="+user.getName()+"&pass="+user.getPass();
    }

    @GetMapping("/loginPage")
    @ResponseBody
    public String loginPage(User user){
        System.out.println( user.getName()+user.getPass());
        return  user.getName()+user.getPass();
    }
}

